package cn.ibizlab.todo.core.pms.client;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import cn.ibizlab.todo.core.pms.domain.Task;
import cn.ibizlab.todo.core.pms.filter.TaskSearchContext;
import org.springframework.cloud.openfeign.FeignClient;

/**
 * 实体[Task] 服务对象接口
 */
@FeignClient(value = "${ibiz.ref.service.pms-webapi:pms-webapi}", contextId = "Task", fallback = TaskFallback.class)
public interface TaskFeignClient {

    @RequestMapping(method = RequestMethod.GET, value = "/tasks/select")
    Page<Task> select();


    @RequestMapping(method = RequestMethod.POST, value = "/tasks")
    Task create(@RequestBody Task task);

    @RequestMapping(method = RequestMethod.POST, value = "/tasks/batch")
    Boolean createBatch(@RequestBody List<Task> tasks);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}")
    Task update(@PathVariable("id") Long id,@RequestBody Task task);

    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/batch")
    Boolean updateBatch(@RequestBody List<Task> tasks);


    @RequestMapping(method = RequestMethod.DELETE, value = "/tasks/{id}")
    Boolean remove(@PathVariable("id") Long id);

    @RequestMapping(method = RequestMethod.DELETE, value = "/tasks/batch}")
    Boolean removeBatch(@RequestBody Collection<Long> idList);


    @RequestMapping(method = RequestMethod.GET, value = "/tasks/{id}")
    Task get(@PathVariable("id") Long id);


    @RequestMapping(method = RequestMethod.GET, value = "/tasks/getdraft")
    Task getDraft();


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/activate")
    Task activate(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/assignto")
    Task assignTo(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/cancel")
    Task cancel(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/checkkey")
    Boolean checkKey(@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/close")
    Task close(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/finish")
    Task finish(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/otherupdate")
    Task otherUpdate(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/pause")
    Task pause(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/restart")
    Task restart(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/save")
    Boolean save(@RequestBody Task task);

    @RequestMapping(method = RequestMethod.POST, value = "/tasks/savebatch")
    Boolean saveBatch(@RequestBody List<Task> tasks);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/start")
    Task start(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/taskfavorites")
    Task taskFavorites(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.POST, value = "/tasks/{id}/tasknfavorites")
    Task taskNFavorites(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/updatedeadline")
    Task updateDeadline(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/updatedesc")
    Task updateDesc(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/updatename")
    Task updateName(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/updatepri")
    Task updatePri(@PathVariable("id") Long id,@RequestBody Task task);


    @RequestMapping(method = RequestMethod.PUT, value = "/tasks/{id}/updatetype")
    Task updateType(@PathVariable("id") Long id,@RequestBody Task task);



    @RequestMapping(method = RequestMethod.POST, value = "/tasks/searchassignedtomytask")
    Page<Task> searchAssignedToMyTask(@RequestBody TaskSearchContext context);



    @RequestMapping(method = RequestMethod.POST, value = "/tasks/searchdefault")
    Page<Task> searchDefault(@RequestBody TaskSearchContext context);



    @RequestMapping(method = RequestMethod.POST, value = "/tasks/searchmyfavorites")
    Page<Task> searchMyFavorites(@RequestBody TaskSearchContext context);



    @RequestMapping(method = RequestMethod.POST, value = "/tasks/searchprojecttask")
    Page<Task> searchProjectTASK(@RequestBody TaskSearchContext context);



    @RequestMapping(method = RequestMethod.POST, value = "/tasks/searchtodolisttask")
    Page<Task> searchTodoListTask(@RequestBody TaskSearchContext context);


}
